﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics.Contracts;

namespace ReactiveCode
{
    [ContractClass(typeof(IObservableEnumerableContract<>))]
    public interface IObservableEnumerable<T>
    {
        IDisposable Subscribe(IEnumerableObserver<T> observer);
    }

    #region Contract of IObservableEnumerable<T>

    [ContractClassFor(typeof(IObservableEnumerable<>))]
    abstract class IObservableEnumerableContract<T> : IObservableEnumerable<T>
    {
        public IDisposable Subscribe(IEnumerableObserver<T> observer)
        {
            Contract.Requires<ArgumentNullException>(observer != null, "observer");
            Contract.Ensures(Contract.Result<IDisposable>() != null);
            return null;
        }
    }

    #endregion
}
